package com.ruoyi.thread;

import java.math.BigDecimal;

public class LockTest4 {
    private static int time = 0;
    private static Object lock = new Object();
    public static void main(String[] args) throws InterruptedException {
        Double a = 1.0;
        BigDecimal b = BigDecimal.valueOf(a);
        for (int i = 0; i < 200; i++) {
            Thread thread = new Thread(() -> {
                for (int j = 0; j < 500; j++) {
                    synchronized (lock) {
                        time++;
                    }
                }
            });
            thread.start();
        }
        Thread.sleep(3000);
        System.out.println(time);
    }
}
